﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;

namespace Manga.Converters
{
    using Windows.UI.Xaml;
    using Windows.UI.Xaml.Data;
    using Windows.UI.Xaml.Controls;

    public class DisplayModeConverter : IValueConverter
    {
        public object Convert(object value, Type targetType, object parameter, string language)
        {
            return ((bool)value) ? SplitViewDisplayMode.Inline : SplitViewDisplayMode.Inline;
        }
        public object ConvertBack(object value, Type targetType, object parameter, string language)
        {
            return ((SplitViewDisplayMode)value) ==  SplitViewDisplayMode.CompactOverlay ? false : true;
        }
    }
    public class VisibilityConverter : IValueConverter
    {
        public object Convert(object value, Type targetType, object parameter, string language)
        {
            if (parameter == null) parameter = true;
            return ((bool)value == bool.Parse(parameter.ToString())) ? Visibility.Visible : Visibility.Collapsed;
        }

        public object ConvertBack(object value, Type targetType, object parameter, string language)
        {
            return ((Visibility)value) == Visibility.Collapsed ? false : true;
        }
    }
}
